﻿using System.Diagnostics;
using System.IO;
using System.Windows;
using SymmetricEncription.Presenters;

namespace SymmetricEncription
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public static readonly DependencyProperty CurrentStepProperty = DependencyProperty.Register("CurrentStep", typeof(ProcessStepBase), typeof(MainWindow), new UIPropertyMetadata(null));
        public ProcessStepBase CurrentStep
        {
            get { return (ProcessStepBase)GetValue(CurrentStepProperty); }
            set { SetValue(CurrentStepProperty, value); }
        }

        public MainWindow()
        {
            InitializeComponent();
            this.CurrentStep = new ParametersInputStep();
        }

        private void btnGoNext_Click(object sender, RoutedEventArgs e)
        {
            var nextStep = this.CurrentStep.GetNextStep();
            if (nextStep != null)
            {
                this.CurrentStep = nextStep;
            }
        }

        private void btnGoPrev_Click(object sender, RoutedEventArgs e)
        {
            var prevStep = this.CurrentStep.PreviousStep;
            if (prevStep != null)
            {
                this.CurrentStep = prevStep;
            }
        }

        private void BtnHeeeeelp_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                Process.Start("HelpChm.chm");
            }
            catch
            {
                MessageBox.Show("Невозможно найти файл помощи", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
    }
}
